package com.xjzd.std.concurrency;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class ScheduleDemo {

    public static void main(String[] args) {
        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
        executorService.schedule(() -> System.out.println("hello"), 1, TimeUnit.SECONDS);
        executorService.scheduleWithFixedDelay(() -> System.out.println("hello"), 0, 1, TimeUnit.SECONDS);
    }
}
